Optimal. Leaf size=316 \[ -\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (2 a^2 e^2 h-c \left (2 a \left (d^2 h-2 d e g+e^2 f\right )+b d (d g+2 e f)\right )-a b e (2 d h+e g)+b^2 \left (d^2 h+e^2 f\right )+2 c^2 d^2 f\right )}{\sqrt{b^2-4 a c} \left (a e^2-b d e+c d^2\right )^2}-\frac{\log \left (a+b x+c x^2\right ) \left (a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )+c d (2 e f-d g)\right )}{2 \left (a e^2-b d e+c d^2\right )^2}-\frac{d^2 h-d e g+e^2 f}{e (d+e x) \left (a e^2-b d e+c d^2\right )}+\frac{\log (d+e x) \left (a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )+c d (2 e f-d g)\right )}{\left (a e^2-b d e+c d^2\right )^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.760674, antiderivative size = 316, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 30, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {1628, 634, 618, 206, 628} \[ -\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (2 a^2 e^2 h-c \left (2 a \left (d^2 h-2 d e g+e^2 f\right )+b d (d g+2 e f)\right )-a b e (2 d h+e g)+b^2 \left (d^2 h+e^2 f\right )+2 c^2 d^2 f\right )}{\sqrt{b^2-4 a c} \left (a e^2-b d e+c d^2\right )^2}-\frac{\log \left (a+b x+c x^2\right ) \left (a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )+c d (2 e f-d g)\right )}{2 \left (a e^2-b d e+c d^2\right )^2}-\frac{d^2 h-d e g+e^2 f}{e (d+e x) \left (a e^2-b d e+c d^2\right )}+\frac{\log (d+e x) \left (a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )+c d (2 e f-d g)\right )}{\left (a e^2-b d e+c d^2\right )^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 1628
Rule 634
Rule 618
Rule 206
Rule 628
Rubi steps
\begin{align*} \int \frac{f+g x+h x^2}{(d+e x)^2 \left (a+b x+c x^2\right )} \, dx &=\int \left (\frac{e^2 f-d e g+d^2 h}{\left (c d^2-b d e+a e^2\right ) (d+e x)^2}+\frac{e \left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right )}{\left (c d^2-b d e+a e^2\right )^2 (d+e x)}+\frac{c^2 d^2 f+e^2 \left (b^2 f-a b g+a^2 h\right )-c \left (2 b d e f+a \left (e^2 f-2 d e g+d^2 h\right )\right )-c \left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) x}{\left (c d^2-b d e+a e^2\right )^2 \left (a+b x+c x^2\right )}\right ) \, dx\\ &=-\frac{e^2 f-d e g+d^2 h}{e \left (c d^2-b d e+a e^2\right ) (d+e x)}+\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log (d+e x)}{\left (c d^2-b d e+a e^2\right )^2}+\frac{\int \frac{c^2 d^2 f+e^2 \left (b^2 f-a b g+a^2 h\right )-c \left (2 b d e f+a \left (e^2 f-2 d e g+d^2 h\right )\right )-c \left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) x}{a+b x+c x^2} \, dx}{\left (c d^2-b d e+a e^2\right )^2}\\ &=-\frac{e^2 f-d e g+d^2 h}{e \left (c d^2-b d e+a e^2\right ) (d+e x)}+\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log (d+e x)}{\left (c d^2-b d e+a e^2\right )^2}-\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \int \frac{b+2 c x}{a+b x+c x^2} \, dx}{2 \left (c d^2-b d e+a e^2\right )^2}+\frac{\left (2 c^2 d^2 f+2 a^2 e^2 h-a b e (e g+2 d h)+b^2 \left (e^2 f+d^2 h\right )-c \left (b d (2 e f+d g)+2 a \left (e^2 f-2 d e g+d^2 h\right )\right )\right ) \int \frac{1}{a+b x+c x^2} \, dx}{2 \left (c d^2-b d e+a e^2\right )^2}\\ &=-\frac{e^2 f-d e g+d^2 h}{e \left (c d^2-b d e+a e^2\right ) (d+e x)}+\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log (d+e x)}{\left (c d^2-b d e+a e^2\right )^2}-\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log \left (a+b x+c x^2\right )}{2 \left (c d^2-b d e+a e^2\right )^2}-\frac{\left (2 c^2 d^2 f+2 a^2 e^2 h-a b e (e g+2 d h)+b^2 \left (e^2 f+d^2 h\right )-c \left (b d (2 e f+d g)+2 a \left (e^2 f-2 d e g+d^2 h\right )\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{\left (c d^2-b d e+a e^2\right )^2}\\ &=-\frac{e^2 f-d e g+d^2 h}{e \left (c d^2-b d e+a e^2\right ) (d+e x)}-\frac{\left (2 c^2 d^2 f+2 a^2 e^2 h-a b e (e g+2 d h)+b^2 \left (e^2 f+d^2 h\right )-c \left (b d (2 e f+d g)+2 a \left (e^2 f-2 d e g+d^2 h\right )\right )\right ) \tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right )}{\sqrt{b^2-4 a c} \left (c d^2-b d e+a e^2\right )^2}+\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log (d+e x)}{\left (c d^2-b d e+a e^2\right )^2}-\frac{\left (c d (2 e f-d g)+a e (e g-2 d h)-b \left (e^2 f-d^2 h\right )\right ) \log \left (a+b x+c x^2\right )}{2 \left (c d^2-b d e+a e^2\right )^2}\\ \end{align*}
Mathematica [A] time = 0.657377, size = 281, normalized size = 0.89 \[ \frac{\frac{2 \tan ^{-1}\left (\frac{b+2 c x}{\sqrt{4 a c-b^2}}\right ) \left (2 a^2 e^2 h-c \left (2 a \left (d^2 h-2 d e g+e^2 f\right )+b d (d g+2 e f)\right )-a b e (2 d h+e g)+b^2 \left (d^2 h+e^2 f\right )+2 c^2 d^2 f\right )}{\sqrt{4 a c-b^2}}-\frac{2 \left (e (a e-b d)+c d^2\right ) \left (d^2 h-d e g+e^2 f\right )}{e (d+e x)}+2 \log (d+e x) \left (a e (e g-2 d h)+b \left (d^2 h-e^2 f\right )+c d (2 e f-d g)\right )+\log (a+x (b+c x)) \left (a e (2 d h-e g)+b \left (e^2 f-d^2 h\right )+c d (d g-2 e f)\right )}{2 \left (e (a e-b d)+c d^2\right )^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.192, size = 1125, normalized size = 3.6 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.31722, size = 606, normalized size = 1.92 \begin{align*} \frac{{\left (2 \, c^{2} d^{2} f e^{2} - b c d^{2} g e^{2} + b^{2} d^{2} h e^{2} - 2 \, a c d^{2} h e^{2} - 2 \, b c d f e^{3} + 4 \, a c d g e^{3} - 2 \, a b d h e^{3} + b^{2} f e^{4} - 2 \, a c f e^{4} - a b g e^{4} + 2 \, a^{2} h e^{4}\right )} \arctan \left (\frac{{\left (2 \, c d - \frac{2 \, c d^{2}}{x e + d} - b e + \frac{2 \, b d e}{x e + d} - \frac{2 \, a e^{2}}{x e + d}\right )} e^{\left (-1\right )}}{\sqrt{-b^{2} + 4 \, a c}}\right ) e^{\left (-2\right )}}{{\left (c^{2} d^{4} - 2 \, b c d^{3} e + b^{2} d^{2} e^{2} + 2 \, a c d^{2} e^{2} - 2 \, a b d e^{3} + a^{2} e^{4}\right )} \sqrt{-b^{2} + 4 \, a c}} + \frac{{\left (c d^{2} g - b d^{2} h - 2 \, c d f e + 2 \, a d h e + b f e^{2} - a g e^{2}\right )} \log \left (c - \frac{2 \, c d}{x e + d} + \frac{c d^{2}}{{\left (x e + d\right )}^{2}} + \frac{b e}{x e + d} - \frac{b d e}{{\left (x e + d\right )}^{2}} + \frac{a e^{2}}{{\left (x e + d\right )}^{2}}\right )}{2 \,{\left (c^{2} d^{4} - 2 \, b c d^{3} e + b^{2} d^{2} e^{2} + 2 \, a c d^{2} e^{2} - 2 \, a b d e^{3} + a^{2} e^{4}\right )}} - \frac{\frac{d^{2} h e}{x e + d} - \frac{d g e^{2}}{x e + d} + \frac{f e^{3}}{x e + d}}{c d^{2} e^{2} - b d e^{3} + a e^{4}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]